package xin.marcher.module.common.enums.quality;

import java.util.HashMap;
import java.util.Map;

/**
 * 风险任务状态枚举类
 */
public enum QualityAuditStatusEnum {
    /**
     * 1-待处理
     */
    PENDING(1, "待处理"),

    /**
     * 2-未通过
     */
    NOT_PASS(2, "未通过"),

    /**
     * 3-已通过
     */
    PASSED(3, "已通过"),

    /**
     * 4-继续提供资质材料
     */
    ADDITIONAL(4, "继续提供资质材料");

    private Integer code;

    private String value;

    QualityAuditStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> map = new HashMap<>(16);
        for (QualityAuditStatusEnum element : QualityAuditStatusEnum.values()) {
            map.put(element.getCode(), element.getValue());
        }
        return map;
    }

    public static QualityAuditStatusEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (QualityAuditStatusEnum element : QualityAuditStatusEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }
}
